// @ts-ignore

/* eslint-disable */
import { request } from 'umi';
/** 获取当前的用户 GET /api/currentUser */

export async function getList(params, options) {
  return request('/baseApi/collectionitem/datatablelistdata', {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  });
}

// 详情
export async function getDetail(params, options) {
  return request('/baseApi/collectionitem/getdatatablebyid', {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  });
}

// 详情sql
export async function getSqlDetail(params, options) {
  return request('/baseApi/collectionitem/getTableSqlbyid', {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  });
}

// sql 查询
export async function upadataField(body, options) {
  return request('/baseApi/originalitem/executesql', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

// 类别列表
export async function getTree(params, options) {
  return request('/baseApi/collectioncatalogue/getDataCatalogueList', {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  });
}

// 库列表
export async function getSourcedataList(params, options) {
  return request('/baseApi/collectiondataresource/getDataResourceList', {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  });
}

// 增加 归集库数据项
export async function addItemField(body, options) {
  return request('/baseApi/collectionitem/addOrUpItem', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

export async function upadataItemField(body, options) {
  return request('/baseApi/collectionitem/addOrUpItem', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

// 获取源数据列表
export async function getDatatablelist(params, options) {
  return request('/baseApi/originalitem/getDatatablelist', {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  });
}
// 获取映射字段
export async function getMappingByTableid(params, options) {
  return request('/baseApi/collectionitem/getMappingByTableid', {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  });
}

// 生成缺省字段
export async function createStructurebybaseTable(params, options) {
  return request('/baseApi/collectionStructure/createStructurebybaseTable', {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  });
}

// 增加 保存
export async function savaFile(body, options) {
  return request('/baseApi/collectionitem/addMapping', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
